import request from '@/utils/request.js'
import { useTokenStore } from '@/strores/token'
export const articleCategoryListService=()=>{
    // const tokenStore=useTokenStore();
    // tokenStore.token
    // return request.get('/task/get-list',{headers:{'Authorization':tokenStore.token}})
    return request.get('/task/get-list')
}


export const articleCategoryAddService=(categoryData)=>{
    const config = { 
        headers: {  
            'Content-Type': 'application/json' 
        } 
    };
    return request.post('/task/add',JSON.stringify(categoryData),config)
    // return axios.post('http://localhost:8080/task/add',JSON.stringify(categoryData),config)
}
export const articleCategoryUpdateService=(categoryData)=>{
    const config = { 
        headers: {  
            'Content-Type': 'application/json' 
        } 
      }; 
    return request.post('/task/update-priority',JSON.stringify(categoryData),config)
}
// export const articleCategoryDeleteService=(deleteItem)=>{
//     return request.post('/task/delete',deleteItem)
// }
export const articleCategoryDeleteService=(loginData)=>{
    const params=new URLSearchParams;
    for(let key in loginData){
        params.append(key,loginData[key]);
    }
    return request.post('/task/delete',params)
}
export const articleAddService=(articleData)=>{
    const config = { 
        headers: {  
            'Content-Type': 'application/json' 
        } 
      }; 
    return request.post('/notice/addNotice',JSON.stringify(articleData),config)
}
export const articleGetListService=()=>{
    // const config = { 
    //     headers: {  
    //         'Content-Type': 'application/json' 
    //     } 
    //   }; 
    return request.get('/notice/getNoticeList')
}

export const articleDeleteService=(articleId)=>{
    // const config = { 
    //     headers: {  
    //         'Content-Type': 'application/json' 
    //     } 
    //   }; 
    const params=new URLSearchParams;
    for(let key in articleId){
        params.append(key,articleId[key]);
    }
    return request.post('/notice/deleteNotice',params)
}
export const  courseGetServier=()=>{
    const config = { 
        headers: {  
            'Content-Type': 'application/json' 
        } 
      }; 
    return request.get('/course/get-course-list/student',config);
}
export const readArticleService=(articleId)=>{
    const params=new URLSearchParams;
    for(let key in articleId){
        params.append(key,articleId[key]);
    }
    return request.post('/notice/updateNoticeStatus',params)
}